package com.xijia;


/**
  * 静态内部类
  * @author wangsong
  * @mail  1720696548@qq.com
  * @date  2020/9/5 0005 10:16
  * @version 1.0.0
  */
public class Singleton06 {

    public Singleton06() {
    }

    /**
     *  静态内部类 （安卓常用）
     */
    private static class SingletonHolder {
        private static final Singleton06 singleton06 = new Singleton06();
    }

    /**
     * 获取静态内部类的 singleton06
     * @return
     */
    public static Singleton06 getInstance() {
        return SingletonHolder.singleton06;
    }


    public static void main(String[] args) {
        Singleton06 instance1 = Singleton06.getInstance();
        Singleton06 instance2 = Singleton06.getInstance();
        System.out.println(instance1 == instance2);
    }

}
